package cn.goour.utils.tools;

import java.util.HashMap;
import java.util.Map;

public class Mime {
	
	private static Map<String, String> map;
	public static String getMime(String ext) {
		if (map == null) {
			map=getMimeMap();
		}
		String re = null;
		re = map.get(ext);
		if (re == null) {
			re="application/octet-stream";
		}
		return re;
	}
	public static Map<String, String> getMimeMap() {
		Map<String, String> map = new HashMap<String, String>();
		map.put("3gp","video/3gpp");
		map.put("ai","application/postscript");
		map.put("aif","audio/x-aiff");
		map.put("aifc","audio/x-aiff");
		map.put("aiff","audio/x-aiff");
		map.put("asc","text/plain");
		map.put("atom","application/atom+xml");
		map.put("au","audio/basic");
		map.put("avi","video/x-msvideo");
		map.put("bcpio","application/x-bcpio");
		map.put("bin","application/octet-stream");
		map.put("bmp","image/bmp");
		map.put("cdf","application/x-netcdf");
		map.put("cgm","image/cgm");
		map.put("class","application/octet-stream");
		map.put("cpio","application/x-cpio");
		map.put("cpt","application/mac-compactpro");
		map.put("csh","application/x-csh");
		map.put("css","text/css");
		map.put("dcr","application/x-director");
		map.put("dif","video/x-dv");
		map.put("dir","application/x-director");
		map.put("djv","image/vnd.djvu");
		map.put("djvu","image/vnd.djvu");
		map.put("dll","application/octet-stream");
		map.put("dmg","application/octet-stream");
		map.put("dms","application/octet-stream");
		map.put("doc","application/msword");
		map.put("dtd","application/xml-dtd");
		map.put("dv","video/x-dv");
		map.put("dvi","application/x-dvi");
		map.put("dxr","application/x-director");
		map.put("eps","application/postscript");
		map.put("etx","text/x-setext");
		map.put("exe","application/octet-stream");
		map.put("ez","application/andrew-inset");
		map.put("flv","video/x-flv");
		map.put("gif","image/gif");
		map.put("gram","application/srgs");
		map.put("grxml","application/srgs+xml");
		map.put("gtar","application/x-gtar");
		map.put("gz","application/x-gzip");
		map.put("hdf","application/x-hdf");
		map.put("hqx","application/mac-binhex40");
		map.put("htm","text/html");
		map.put("html","text/html");
		map.put("ice","x-conference/x-cooltalk");
		map.put("ico","image/x-icon");
		map.put("ics","text/calendar");
		map.put("ief","image/ief");
		map.put("ifb","text/calendar");
		map.put("iges","model/iges");
		map.put("igs","model/iges");
		map.put("jnlp","application/x-java-jnlp-file");
		map.put("jp2","image/jp2");
		map.put("jpe","image/jpeg");
		map.put("jpeg","image/jpeg");
		map.put("jpg","image/jpeg");
		map.put("js","application/x-javascript");
		map.put("kar","audio/midi");
		map.put("latex","application/x-latex");
		map.put("lha","application/octet-stream");
		map.put("lzh","application/octet-stream");
		map.put("m3u","audio/x-mpegurl");
		map.put("m4a","audio/mp4a-latm");
		map.put("m4p","audio/mp4a-latm");
		map.put("m4u","video/vnd.mpegurl");
		map.put("m4v","video/x-m4v");
		map.put("mac","image/x-macpaint");
		map.put("man","application/x-troff-man");
		map.put("mathml","application/mathml+xml");
		map.put("me","application/x-troff-me");
		map.put("mesh","model/mesh");
		map.put("mid","audio/midi");
		map.put("midi","audio/midi");
		map.put("mif","application/vnd.mif");
		map.put("mov","video/quicktime");
		map.put("movie","video/x-sgi-movie");
		map.put("mp2","audio/mpeg");
		map.put("mp3","audio/mpeg");
		map.put("mp4","video/mp4");
		map.put("mpe","video/mpeg");
		map.put("mpeg","video/mpeg");
		map.put("mpg","video/mpeg");
		map.put("mpga","audio/mpeg");
		map.put("ms","application/x-troff-ms");
		map.put("msh","model/mesh");
		map.put("mxu","video/vnd.mpegurl");
		map.put("nc","application/x-netcdf");
		map.put("oda","application/oda");
		map.put("ogg","application/ogg");
		map.put("ogv","video/ogv");
		map.put("pbm","image/x-portable-bitmap");
		map.put("pct","image/pict");
		map.put("pdb","chemical/x-pdb");
		map.put("pdf","application/pdf");
		map.put("pgm","image/x-portable-graymap");
		map.put("pgn","application/x-chess-pgn");
		map.put("pic","image/pict");
		map.put("pict","image/pict");
		map.put("png","image/png");
		map.put("pnm","image/x-portable-anymap");
		map.put("pnt","image/x-macpaint");
		map.put("pntg","image/x-macpaint");
		map.put("ppm","image/x-portable-pixmap");
		map.put("ppt","application/vnd.ms-powerpoint");
		map.put("ps","application/postscript");
		map.put("qt","video/quicktime");
		map.put("qti","image/x-quicktime");
		map.put("qtif","image/x-quicktime");
		map.put("ra","audio/x-pn-realaudio");
		map.put("ram","audio/x-pn-realaudio");
		map.put("ras","image/x-cmu-raster");
		map.put("rdf","application/rdf+xml");
		map.put("rgb","image/x-rgb");
		map.put("rm","application/vnd.rn-realmedia");
		map.put("roff","application/x-troff");
		map.put("rtf","text/rtf");
		map.put("rtx","text/richtext");
		map.put("sgm","text/sgml");
		map.put("sgml","text/sgml");
		map.put("sh","application/x-sh");
		map.put("shar","application/x-shar");
		map.put("silo","model/mesh");
		map.put("sit","application/x-stuffit");
		map.put("skd","application/x-koan");
		map.put("skm","application/x-koan");
		map.put("skp","application/x-koan");
		map.put("skt","application/x-koan");
		map.put("smi","application/smil");
		map.put("smil","application/smil");
		map.put("snd","audio/basic");
		map.put("so","application/octet-stream");
		map.put("spl","application/x-futuresplash");
		map.put("src","application/x-wais-source");
		map.put("sv4cpio","application/x-sv4cpio");
		map.put("sv4crc","application/x-sv4crc");
		map.put("svg","image/svg+xml");
		map.put("swf","application/x-shockwave-flash");
		map.put("t","application/x-troff");
		map.put("tar","application/x-tar");
		map.put("tcl","application/x-tcl");
		map.put("tex","application/x-tex");
		map.put("texi","application/x-texinfo");
		map.put("texinfo","application/x-texinfo");
		map.put("tif","image/tiff");
		map.put("tiff","image/tiff");
		map.put("tr","application/x-troff");
		map.put("tsv","text/tab-separated-values");
		map.put("txt","text/plain");
		map.put("ustar","application/x-ustar");
		map.put("vcd","application/x-cdlink");
		map.put("vrml","model/vrml");
		map.put("vxml","application/voicexml+xml");
		map.put("wav","audio/x-wav");
		map.put("wbmp","image/vnd.wap.wbmp");
		map.put("wbxml","application/vnd.wap.wbxml");
		map.put("webm","video/webm");
		map.put("wml","text/vnd.wap.wml");
		map.put("wmlc","application/vnd.wap.wmlc");
		map.put("wmls","text/vnd.wap.wmlscript");
		map.put("wmlsc","application/vnd.wap.wmlscriptc");
		map.put("wmv","video/x-ms-wmv");
		map.put("wrl","model/vrml");
		map.put("xbm","image/x-xbitmap");
		map.put("xht","application/xhtml+xml");
		map.put("xhtml","application/xhtml+xml");
		map.put("xls","application/vnd.ms-excel");
		map.put("xml","application/xml");
		map.put("xpm","image/x-xpixmap");
		map.put("xsl","application/xml");
		map.put("xslt","application/xslt+xml");
		map.put("xul","application/vnd.mozilla.xul+xml");
		map.put("xwd","image/x-xwindowdump");
		map.put("xyz","chemical/x-xyz");
		map.put("zip","application/zip");
		map.put("apk","application/vnd.android.package-archive");
		map.put("bin","application/octet-stream");
		map.put("cab","application/vnd.ms-cab-compressed");
		map.put("gb","application/chinese-gb");
		map.put("gba","application/octet-stream");
		map.put("gbc","application/octet-stream");
		map.put("jad","text/vnd.sun.j2me.app-descriptor");
		map.put("jar","application/java-archive");
		map.put("nes","application/octet-stream");
		map.put("rar","application/x-rar-compressed");
		map.put("sis","application/vnd.symbian.install");
		map.put("sisx","x-epoc/x-sisx-app");
		map.put("smc","application/octet-stream");
		map.put("smd","application/octet-stream");
		map.put("swf","application/x-shockwave-flash");
		map.put("zip","application/x-zip-compressed");
		map.put("wap","text/vnd.wap.wmlwml");
		map.put("mrp","application/mrp");
		map.put("wma","audio/x-ms-wma");
		map.put("lrc","application/lrc");
		map.put("907","drawing/907");
		map.put("fif","application/fractals");
		map.put("pr","application/x-pr");
		map.put("xlw","application/x-xlw");
		map.put("hmr","application/x-hmr");
		map.put("ssm","application/streamingmedia");
		map.put("der","application/x-x509-ca-cert");
		map.put("rmvb","application/vnd.rn-realmedia-vbr");
		//map.put("exe","application/x-msdownload");
		map.put("exe","application/octet-stream");
		map.put("java","java/*");
		map.put("sst","application/vnd.ms-pki.certstore");
		//map.put("xml","text/xml");
		map.put("xml","application/xml");
		map.put("wkq","application/x-wkq");
		map.put("wks","application/x-wks");
		map.put("tg4","application/x-tg4");
		map.put("mxp","application/x-mmxp");
		map.put("rat","application/rat-file");
		//map.put("ras","application/x-ras");
		map.put("ras","image/x-cmu-raster");
		//map.put("png","application/x-png");
		//map.put("png","image/png");
		map.put("*","application/octet-stream");
		map.put("stl","application/vnd.ms-pki.stl");
		map.put("stm","text/html");
		//map.put("ra","audio/vnd.rn-realaudio");
		map.put("ra","audio/x-pn-realaudio");
		map.put("cdr","application/x-cdr");
		map.put("001","application/x-001");
		map.put("dwf","application/x-dwf");
		map.put("dwg","application/x-dwg");
		map.put("mht","message/rfc822");
		map.put("sty","application/x-sty");
		map.put("rp","image/vnd.rn-realpix");
		map.put("sdp","application/sdp");
		map.put("a11","application/x-a11");
		map.put("rt","text/vnd.rn-realtext");
		map.put("cut","application/x-cut");
		map.put("rv","video/vnd.rn-realvideo");
		map.put("jsp","text/html");
		map.put("sdw","application/x-sdw");
		//map.put("mid","audio/mid");
		map.put("mid","audio/midi");
		map.put("dgn","application/x-dgn");
		map.put("cel","application/x-cel");
		map.put("dxb","application/x-dxb");
		map.put("tga","application/x-tga");
		map.put("wmd","application/x-ms-wmd");
		map.put("cer","application/x-x509-ca-cert");
		map.put("cg4","application/x-g4");
		map.put("mil","application/x-mil");
		map.put("wmf","application/x-wmf");
		map.put("dxf","application/x-dxf");
		map.put("wsdl","text/xml");
		map.put("pot","application/vnd.ms-powerpoint");
		map.put("x_b","application/x-x_b");
		map.put("uin","application/x-icq");
		map.put("hpg","application/x-hpgl");
		map.put("ppa","application/vnd.ms-powerpoint");
		map.put("c4t","application/x-c4t");
		map.put("wmx","video/x-ms-wmx");
		map.put("xquery","text/xml");
		map.put("hpl","application/x-hpl");
		//map.put("rtf","application/x-rtf");
		map.put("rtf","text/rtf");
		//map.put("svg","text/xml");
		map.put("svg","image/svg+xml");
		map.put("wmz","application/x-ms-wmz");
		map.put("gp4","application/x-gp4");
		//map.put("ppm","application/x-ppm");
		map.put("ppm","image/x-portable-pixmap");
		map.put("x_t","application/x-x_t");
		map.put("asa","text/asa");
		map.put("pps","application/vnd.ms-powerpoint");
		map.put("asf","video/x-ms-asf");
		map.put("ppt","application/x-ppt");
		map.put("ppt","application/vnd.ms-powerpoint");
		//map.put("rdf","text/xml");
		map.put("rdf","application/rdf+xml");
		map.put("xpl","audio/scpls");
		map.put("dib","application/x-dib");
		map.put("wp6","application/x-wp6");
		map.put("asp","text/asp");
		map.put("asx","video/x-ms-asf");
		map.put("isp","application/x-internet-signup");
		//map.put("cgm","application/x-cgm");
		map.put("cgm","image/cgm");
		map.put("icb","application/x-icb");
		map.put("p10","application/pkcs10");
		map.put("acp","audio/x-mei-aac");
		map.put("p12","application/x-pkcs12");
		map.put("red","application/x-red");
		//map.put("tif","application/x-tif");
		map.put("tif","image/tiff");
		map.put("rec","application/vnd.rn-recording");
		map.put("r3t","text/vnd.rn-realtext3d");
		map.put("xql","text/xml");
		//map.put("ico","application/x-ico");
		map.put("ico","image/x-icon");
		map.put("vml","text/xml");
		map.put("wq1","application/x-wq1");
		map.put("hrf","application/x-hrf");
		map.put("pc5","application/x-pc5");
		map.put("prf","application/pics-rules");
		map.put("wpd","application/x-wpd");
		map.put("g4","application/x-g4");
		map.put("prn","application/x-prn");
		map.put("wpg","application/x-wpg");
		map.put("wpl","application/vnd.ms-wpl");
		map.put("prt","application/x-prt");
		map.put("wr1","application/x-wr1");
		map.put("IVF","video/x-ivf");
		map.put("c90","application/x-c90");
		map.put("uls","text/iuls");
		map.put("emf","application/x-emf");
		map.put("lavs","audio/x-liquid-secure");
		map.put("aiff","audio/x-aiff");
		map.put("eml","message/rfc822");
		map.put("wb2","application/x-wb2");
		map.put("wb1","application/x-wb1");
		map.put("aifc","audio/x-aiff");
		map.put("xsd","text/xml");
		map.put("fo","text/xml");
		map.put("wb3","application/x-wb3");
		map.put("rgb","image/x-rgb");
		//map.put("rgb","application/x-rgb");
		map.put("mml","text/xml");
		map.put("cit","application/x-cit");
		map.put("xsl","application/xml");
		//map.put("xsl","text/xml");
		map.put("hta","application/hta");
		map.put("avi","video/avi");
		//map.put("avi","video/x-msvideo");
		map.put("htc","text/x-component");
		map.put("wm","video/x-ms-wm");
		map.put("ig4","application/x-g4");
		map.put("pci","application/x-pci");
		map.put("ws2","application/x-ws");
		map.put("pcl","application/x-pcl");
		map.put("ws","application/x-ws");
		//map.put("class","java/*");
		map.put("class","application/octet-stream");
		map.put("mnd","audio/x-musicnet-download");
		map.put("pcx","application/x-pcx");
		map.put("dll","application/octet-stream");
		//map.put("dll","application/x-msdownload");
		map.put("iff","application/x-iff");
		map.put("htt","text/webviewhtml");
		map.put("ent","text/xml");
		map.put("ptn","application/x-ptn");
		map.put("vpg","application/x-vpeg005");
		map.put("htx","text/html");
		map.put("tld","text/xml");
		map.put("wav","audio/wav");
		//map.put("wav","audio/x-wav");
		//map.put("mp2","audio/mp2");
		map.put("mp2","audio/mpeg");
		map.put("mp1","audio/mp1");
		map.put("wax","audio/x-ms-wax");
		map.put("wri","application/x-wri");
		map.put("xhtml","text/html");
		//map.put("xhtml","application/xhtml+xml");
		//map.put("mp4","video/mpeg4");
		map.put("mp4","video/mp4");
		map.put("awf","application/vnd.adobe.workflow");
		map.put("mp3","audio/mp3");
		//map.put("mp3","audio/mpeg");
		map.put("wrk","application/x-wrk");
		map.put("mns","audio/x-musicnet-stream");
		map.put("gbr","application/x-gbr");
		map.put("xq","text/xml");
		map.put("pdx","application/vnd.adobe.pdx");
		map.put("xdp","application/vnd.adobe.xdp");
		map.put("wsc","text/scriptlet");
		map.put("xdr","text/xml");
		map.put("gcd","application/x-gcd");
		map.put("biz","text/xml");
		map.put("midi","audio/mid");
		//map.put("midi","audio/midi");
		map.put("igs","application/x-igs");
		//map.put("igs","model/iges");
		map.put("fax","image/fax");
		map.put("epi","application/x-epi");
		map.put("mpa","video/x-mpg");
		map.put("frm","application/x-frm");
		map.put("mpd","application/vnd.ms-project");
		map.put("mpe","video/mpeg");
		//map.put("mpe","video/x-mpeg");
		map.put("nrf","application/x-nrf");
		//map.put("mpg","video/mpg");
		map.put("mpg","video/mpeg");
		map.put("slb","application/x-slb");
		map.put("torrent","application/x-bittorrent");
		map.put("sld","application/x-sld");
		map.put("mpp","application/vnd.ms-project");
		map.put("odc","text/x-ms-odc");
		map.put("mpt","application/vnd.ms-project");
		map.put("mps","video/x-mpeg");
		map.put("mpv","video/mpg");
		map.put("slk","drawing/x-slk");
		map.put("mpx","application/vnd.ms-project");
		map.put("mpw","application/vnd.ms-project");
		map.put("xfd","application/vnd.adobe.xfd");
		map.put("rjs","application/vnd.rn-realsystem-rjs");
		map.put("math","text/xml");
		map.put("rjt","application/vnd.rn-realsystem-rjt");
		map.put("aif","audio/aiff");
		//map.put("aif","audio/x-aiff");
		map.put("cml","text/xml");
		map.put("pfx","application/x-pkcs12");
		map.put("xwd","application/x-xwd");
		//map.put("xwd","image/x-xwindowdump");
		map.put("vsd","application/x-vsd");
		map.put("cmp","application/x-cmp");
		map.put("dot","application/msword");
		map.put("iii","application/x-iphone");
		map.put("hgl","application/x-hgl");
		//map.put("mac","application/x-mac");
		map.put("mac","image/x-macpaint");
		map.put("cmx","application/x-cmx");
		map.put("out","application/x-out");
		map.put("smk","application/x-smk");
		map.put("pwz","application/vnd.ms-powerpoint");
		map.put("mp2v","video/mpeg");
		map.put("pgl","application/x-pgl");
		map.put("top","drawing/x-top");
		map.put("vst","application/x-vst");
		map.put("vss","application/vnd.visio");
		map.put("vcf","text/x-vcard");
		map.put("vsx","application/vnd.visio");
		map.put("vsw","application/vnd.visio");
		map.put("la1","audio/x-liquid-file");
		map.put("jfif","image/jpeg");
		map.put("rlc","application/x-rlc");
		map.put("fdf","application/vnd.fdf");
		map.put("rle","application/x-rle");
		map.put("mpv2","video/mpeg");
		map.put("vda","application/x-vda");
		map.put("301","application/x-301");
		map.put("lmsff","audio/x-la-lms");
		map.put("wvx","video/x-ms-wvx");
		map.put("p7b","application/x-pkcs7-certificates");
		map.put("vtx","application/vnd.visio");
		map.put("p7c","application/pkcs7-mime");
		//map.put("bmp","application/x-bmp");
		map.put("bmp","image/bmp");
		map.put("ls","application/x-javascript");
		map.put("p7m","application/pkcs7-mime");
		map.put("cot","application/x-cot");
		map.put("mocha","application/x-javascript");
		map.put("p7r","application/x-pkcs7-certreqresp");
		map.put("rmf","application/vnd.adobe.rmf");
		//map.put("pic","application/x-pic");
		map.put("pic","image/pict");
		map.put("vdx","application/vnd.visio");
		map.put("p7s","application/pkcs7-signature");
		//map.put("mpga","audio/rn-mpeg");
		map.put("mpga","audio/mpeg");
		map.put("rmj","application/vnd.rn-realsystem-rmj");
		map.put("rmi","audio/mid");
		map.put("sol","text/plain");
		map.put("m1v","video/x-mpeg");
		map.put("rmm","audio/x-pn-realaudio");
		map.put("etd","application/x-ebx");
		map.put("rmp","application/vnd.rn-rn_music_package");
		map.put("rsml","application/vnd.rn-rsml");
		map.put("sor","text/plain");
		map.put("rms","application/vnd.rn-realmedia-secure");
		map.put("lar","application/x-laplayer-reg");
		map.put("mi","application/x-mi");
		map.put("net","image/pnetvue");
		map.put("rmx","application/vnd.rn-realsystem-rmx");
		map.put("spc","application/x-pkcs7-certificates");
		map.put("drw","application/x-drw");
		map.put("dbf","application/x-dbf");
		map.put("mhtml","message/rfc822");
		map.put("mdb","application/x-mdb");
		map.put("dbm","application/x-dbm");
		map.put("edn","application/vnd.adobe.edn");
		//map.put("spl","application/futuresplash");
		map.put("spl","application/x-futuresplash");
		map.put("m2v","video/x-mpeg");
		map.put("mtx","text/xml");
		map.put("spp","text/xml");
		map.put("323","text/h323");
		map.put("lbm","application/x-lbm");
		//map.put("mpeg","video/mpg");
		map.put("mpeg","video/mpeg");
		map.put("dbx","application/x-dbx");
		map.put("rnx","application/vnd.rn-realplayer");
		map.put("img","application/x-img");
		map.put("dcd","text/xml");
		map.put("tsd","text/xml");
		map.put("bot","application/x-bot");
		map.put("xfdf","application/vnd.adobe.xfdf");
		map.put("nws","message/rfc822");
		map.put("m3u","audio/mpegurl");
		//map.put("m3u","audio/x-mpegurl");
		map.put("cal","application/x-cals");
		map.put("dtd","text/xml");
		//map.put("dtd","application/xml-dtd");
		map.put("pko","application/vnd.ms-pki.pko");
		map.put("vxml","text/xml");
		//map.put("vxml","application/voicexml+xml");
		map.put("cat","application/vnd.ms-pki.seccat");
		map.put("dcx","application/x-dcx");
		map.put("crl","application/pkix-crl");
		//map.put("jpe","application/x-jpe");
		map.put("jpe","image/jpeg");
		map.put("sam","application/x-sam");
		map.put("wk3","application/x-wk3");
		map.put("m4e","video/mpeg4");
		//map.put("jpg","application/x-jpg");
		//map.put("jpg","image/jpeg");
		map.put("wk4","application/x-wk4");
		map.put("crt","application/x-x509-ca-cert");
		map.put("sat","application/x-sat");
		map.put("anv","application/x-anv");
		map.put("wiz","application/msword");
		map.put("plg","text/html");
		map.put("ltr","application/x-ltr");
		map.put("gl2","application/x-gl2");
		map.put("rpm","audio/x-pn-realaudio-plugin");
		map.put("ins","application/x-internet-signup");
		map.put("mfp","application/x-shockwave-flash");
		map.put("pls","audio/scpls");
		map.put("tdf","application/x-tdf");
		map.put("csi","application/x-csi");
		map.put("plt","application/x-plt");
		//map.put("xslt","text/xml");
		map.put("xslt","application/xslt+xml");
		map.put("pl","application/x-perl");
		//map.put("xls","application/x-xls");
		map.put("xls","application/vnd.ms-excel");
		map.put("906","application/x-906");
		return map;
	}
}
